package com.application.chiettinhdienluc.model;

import android.content.ContentResolver;
import android.net.Uri;

import com.application.chiettinhdienluc.data.GlobalData;

public class VattuModel {

	public static final String VATTU_TABLE_NAME = "D_VATTU";
	
	/**
     * Content type for account / sip profile
     */
    public final static String VATTU_CONTENT_TYPE = GlobalData.BASE_DIR_TYPE + ".D_VATTU";
    /**
     * Item type for account / sip profile
     */
    public final static String VATTU_CONTENT_ITEM_TYPE = GlobalData.BASE_ITEM_TYPE + ".D_VATTU";
    
    public final static Uri VATTU_ID_URI_BASE = Uri.parse(ContentResolver.SCHEME_CONTENT + "://"
            + GlobalData.AUTHORITY + "/" + VATTU_TABLE_NAME + "/");
	
    public static final String FIELD_VATTU_ID 		= "id";
	public static final String FIELD_MA_VATTU 		= "MA_VATTU";
	public static final String FIELD_TEN_VATTU 		= "TEN_VATTU";
	public static final String FIELD_QUY_CACH 		= "QUY_CACH";
	public static final String FIELD_DON_GIA 		= "DON_GIA";
	public static final String FIELD_GHI_CHU 		= "GHI_CHU";
	public static final String FIELD_MA_DVIQLY 		= "MA_DVIQLY";
	public static final String FIELD_SU_DUNG 		= "SU_DUNG";
	public static final String FIELD_NGAY_CAP_NHAT 	= "NGAY_CAP_NHAT";
	
	
	public final static String[] VATTU_FULL_PROJECTION = {
		VattuModel.FIELD_MA_VATTU,
		VattuModel.FIELD_TEN_VATTU,
		VattuModel.FIELD_QUY_CACH,
		VattuModel.FIELD_DON_GIA,
		VattuModel.FIELD_GHI_CHU,
		VattuModel.FIELD_MA_DVIQLY,
		VattuModel.FIELD_SU_DUNG,
		VattuModel.FIELD_NGAY_CAP_NHAT
	};
	
	// private variables
	private String _maVattu;
	private String _tenVattu;
	private String _quyCach;
	private double _donGia;
	private String _ghiChu;
	private String _ma_DVIQLY;
	private boolean _suDung;
	private String _ngayCapNhat;
	private double _soluong;

	// Empty constructor
	public VattuModel() {

	}

	// constructor
	public VattuModel(String id, String name, String quycach) {
		this._maVattu = id;
		this._tenVattu = name;
		this._quyCach = quycach;
	}

	// constructor
	public VattuModel(String name, String quycach) {
		this._tenVattu = name;
		this._quyCach = quycach;
	}
	// constructor
	public VattuModel(String name, boolean suDung) {
		this._tenVattu = name;
		this._suDung = suDung;
	}

	// getting ID
	public String getMaVattu() {
		return this._maVattu;
	}

	// setting id
	public void setMaVattu(String id) {
		this._maVattu = id;
	}

	// getting name
	public String getTenVattu() {
		return this._tenVattu;
	}

	// setting name
	public void setTenVattu(String name) {
		this._tenVattu = name;
	}

	public String getQuyCach() {
		return this._quyCach;
	}

	public void setQuyCach(String quycach) {
		this._quyCach = quycach;
	}

	public double getDonGia() {
		return _donGia;
	}

	public void setDonGia(double _donGia) {
		this._donGia = _donGia;
	}

	public String getGhiChu() {
		return _ghiChu;
	}

	public void setGhiChu(String _ghiChu) {
		this._ghiChu = _ghiChu;
	}

	public String getMaDVIQLY() {
		return _ma_DVIQLY;
	}

	public void setMaDVIQLY(String _ma_DVIQLY) {
		this._ma_DVIQLY = _ma_DVIQLY;
	}


	public String getNgayCapNhat() {
		return _ngayCapNhat;
	}

	public void setNgayCapNhat(String _ngayCapNhat) {
		this._ngayCapNhat = _ngayCapNhat;
	}

	public boolean isSuDung() {
		return _suDung;
	}

	public void setSuDung(boolean suDung) {
		if(_suDung != suDung )
			_hasChanged = true;
		this._suDung = suDung;
	}
	
	public double getSoluong() {
		return _soluong;
	}

	public void setSoluong(double _soluong) {
		this._soluong = _soluong;
	}
	
	private boolean _hasChanged = false;
	
	public boolean hasChanged()
	{
		return _hasChanged;		
	}
	
	public void setHasChanged(boolean hasChanged)
	{
		 _hasChanged = hasChanged;		
	}	
	
}
